home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / libscsi1.zoo / LibScsi-0.01 / req_sens.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-14  |  627 b   |  31 lines

  1. /*
  2.  * req_sens.c - Copyright Steve Woodford, August 1993.
  3.  *
  4.  * Send 'request sense' command to SCSI target. Returns sense data.
  5.  */
  6.  
  7. #include <sys/types.h>
  8. #include <sys/scsi.h>
  9. #include "libscsi.h"
  10.  
  11.  
  12. PUBLIC  short
  13. Scsi_Request_Sense(u_char id, void *sbuf, u_short len)
  14. {
  15.     Scsi_Cmd    sc;
  16.  
  17.     if ( id & 0xc0 )
  18.         return(-1);
  19.  
  20.     (void) _Scsi_Timeout( T_Normal(id) );
  21.  
  22.     sc.sc_command = CMD(id, SZ_CMD_REQUEST_SENSE);
  23.     sc.sc_z[0]    = LUN(id, 0);
  24.     sc.sc_z[1]    = 0;
  25.     sc.sc_z[2]    = 0;
  26.     sc.sc_z[3]    = (u_char) len;
  27.     sc.sc_link    = 0;
  28.  
  29.     return ( _Scsi_Read_Bytes( &sc, sbuf, (u_char)len ) );
  30. }
  31.